<?php

use Illuminate\Database\Seeder;

/**
 * Copyright (C), 2016-2018, Shall Buy Life info. Co., Ltd.
 * FileName: BusinessSeeder.php
 * Description: 说明
 *
 * @author drx
 * @Create Date    2021/7/9 9:12
 * @Update Date    2021/7/9 9:12 By drx
 * @version v1.0
 */
class BusinessSeeder extends Seeder{
    /**
     * 0:parent_id = 0,all:所有数据
     */
    const BUSINESS_LEVEL = 0;

    /**
     * FunctionName：run
     * Description：
     * Author：lwl
     */
    public function run()
    {
        $data = [
            ['id' => 1 , 'title' => '平台','unique_code' => 'pingtai' , 'parent_id' => 0],
            ['id' => 2 , 'title' => '医药','unique_code' => 'yiyao' , 'parent_id' => 0],
            ['id' => 3 , 'title' => '房产','unique_code' => 'fangchang' , 'parent_id' => 0],
            ['id' => 4 , 'title' => '汽车','unique_code' => 'qiche' , 'parent_id' => 0],
            ['id' => 5 , 'title' => 'O2O','unique_code' => 'o2o' , 'parent_id' => 0],
            ['id' => 6 , 'title' => '电商','unique_code' => 'dianshang' , 'parent_id' => 0],
            ['id' => 7 , 'title' => '出行','unique_code' => 'chuxing' , 'parent_id' => 0],
            ['id' => 8 , 'title' => '生活缴费','unique_code' => 'shenghuojiaofei' , 'parent_id' => 0],
            ['id' => 9 , 'title' => '充值','unique_code' => 'chongzhi' , 'parent_id' => 0],
            ['id' => 10 , 'title' => '游戏','unique_code' => 'youxi' , 'parent_id' => 0],
            ['id' => 11 , 'title' => '酒店','unique_code' => 'jiudian' , 'parent_id' => 0],
            ['id' => 12 , 'title' => '积分打电话','unique_code' => 'jifendadianhua' , 'parent_id' => 0],
            ['id' => 13 , 'title' => '三方商城','unique_code' => 'sanfang' , 'parent_id' => 0],
            ['id' => 14 , 'title' => '物联网','unique_code' => 'wulianwang' , 'parent_id' => 0],
            ['id' => 15 , 'title' => '本地生活','unique_code' => 'bendishenghuo' , 'parent_id' => 0],
            ['id' => 16 , 'title' => '平台','unique_code' => 'pingtai1' , 'parent_id' => 1],
            ['id' => 17 , 'title' => '代理商','unique_code' => 'dailishang' , 'parent_id' => 1],
            ['id' => 18 , 'title' => '群主','unique_code' => 'qunzhu' , 'parent_id' => 1],
            ['id' => 19 , 'title' => '达人','unique_code' => 'daren' , 'parent_id' => 1],
            ['id' => 20 , 'title' => '玩转积分','unique_code' => 'wanzhuanjifen' , 'parent_id' => 1],
            ['id' => 21 , 'title' => '余额','unique_code' => 'yue' , 'parent_id' => 1],
            ['id' => 22 , 'title' => '投资','unique_code' => 'touzi' , 'parent_id' => 1],
            ['id' => 23 , 'title' => '账号代运营','unique_code' => 'zhanghaodaiyunying' , 'parent_id' => 1],
            ['id' => 24 , 'title' => '医药','unique_code' => 'yiyao1' , 'parent_id' => 2],
            ['id' => 25 , 'title' => '租房','unique_code' => 'zufang' , 'parent_id' => 3],
            ['id' => 26 , 'title' => '新房','unique_code' => 'xinfang' , 'parent_id' => 3],
            ['id' => 27 , 'title' => '二手房','unique_code' => 'ershoufang' , 'parent_id' => 3],
            ['id' => 28 , 'title' => '商业圈','unique_code' => 'shangyequan' , 'parent_id' => 3],
            ['id' => 29 , 'title' => '物业','unique_code' => 'wuye' , 'parent_id' => 3],
            ['id' => 30 , 'title' => '买车','unique_code' => 'maiche1' , 'parent_id' => 4],
            ['id' => 31 , 'title' => '卖车','unique_code' => 'maiche2' , 'parent_id' => 4],
            ['id' => 32 , 'title' => '招商加盟','unique_code' => 'zhangshangjiameng' , 'parent_id' => 4],
            ['id' => 33 , 'title' => '扫码报单','unique_code' => 'saomabaodan' , 'parent_id' => 5],
            ['id' => 34 , 'title' => '立即买单','unique_code' => 'lijimaidan' , 'parent_id' => 5],
            ['id' => 35 , 'title' => '共享饭店','unique_code' => 'gongxiangfandian' , 'parent_id' => 5],
            ['id' => 36 , 'title' => '小巴电器','unique_code' => 'xiaobadianqi' , 'parent_id' => 6],
            ['id' => 37 , 'title' => '小巴服饰','unique_code' => 'xiaobafushi' , 'parent_id' => 6],
            ['id' => 38 , 'title' => '小巴珠宝','unique_code' => 'xiaobazhubao' , 'parent_id' => 6],
            ['id' => 39 , 'title' => '小巴超市','unique_code' => 'xiaobachaoshi' , 'parent_id' => 6],
            ['id' => 40 , 'title' => '三年购','unique_code' => 'sanniangou' , 'parent_id' => 6],
            ['id' => 41 , 'title' => '供应链','unique_code' => 'gongyinglian' , 'parent_id' => 6],
            ['id' => 42 , 'title' => '打车','unique_code' => 'dache' , 'parent_id' => 7],
            ['id' => 43 , 'title' => '机票','unique_code' => 'jipiao' , 'parent_id' => 7],
            ['id' => 44 , 'title' => '火车票','unique_code' => 'huochepiao' , 'parent_id' => 7],
            ['id' => 45 , 'title' => '汽车票','unique_code' => 'qichepiao' , 'parent_id' => 7],
            ['id' => 46 , 'title' => '轮船票','unique_code' => 'lunchuanpiao' , 'parent_id' => 7],
            ['id' => 47 , 'title' => '水费','unique_code' => 'shuifei' , 'parent_id' => 8],
            ['id' => 48 , 'title' => '电费','unique_code' => 'dianfei' , 'parent_id' => 8],
            ['id' => 49 , 'title' => '燃气费','unique_code' => 'ranqifei' , 'parent_id' => 8],
            ['id' => 50 , 'title' => '物业费','unique_code' => 'wuyefei' , 'parent_id' => 8],
            ['id' => 51 , 'title' => '有线电视','unique_code' => 'youxiandianshi' , 'parent_id' => 8],
            ['id' => 52 , 'title' => '宽带','unique_code' => 'kuandai' , 'parent_id' => 8],
            ['id' => 53 , 'title' => '固话','unique_code' => 'guhua' , 'parent_id' => 8],
            ['id' => 54 , 'title' => '话费','unique_code' => 'huafei' , 'parent_id' => 9],
            ['id' => 55 , 'title' => '爱奇艺','unique_code' => 'qiaiyi' , 'parent_id' => 9],
            ['id' => 56 , 'title' => '腾讯视频','unique_code' => 'tenxunshipin' , 'parent_id' => 9],
            ['id' => 57 , 'title' => '优酷视频','unique_code' => 'youkushipin' , 'parent_id' => 9],
            ['id' => 58 , 'title' => '芒果TV','unique_code' => 'wangguotv' , 'parent_id' => 9],
            ['id' => 59 , 'title' => 'QQ音乐','unique_code' => 'qqyinyue' , 'parent_id' => 9],
            ['id' => 60 , 'title' => '酷狗音乐','unique_code' => 'kugouyinyue' , 'parent_id' => 9],
            ['id' => 61 , 'title' => '百度网盘','unique_code' => 'baiduwangpan' , 'parent_id' => 9],
            ['id' => 62 , 'title' => '新浪微博','unique_code' => 'xinlangweibo' , 'parent_id' => 9],
            ['id' => 63 , 'title' => 'KEEP','unique_code' => 'keep' , 'parent_id' => 9],
            ['id' => 64 , 'title' => '斗地主','unique_code' => 'doudizhu' , 'parent_id' => 10],
            ['id' => 65 , 'title' => '打麻将','unique_code' => 'damajiang' , 'parent_id' => 10],
            ['id' => 66 , 'title' => '小巴小游戏','unique_code' => 'xiaobaxiaoyouxi' , 'parent_id' => 10],
            ['id' => 67 , 'title' => '闪电玩小游戏','unique_code' => 'shandianwanxiaoyouxi' , 'parent_id' => 10],
            ['id' => 68 , 'title' => '趣变小游戏','unique_code' => 'qubianxiaoyouxi' , 'parent_id' => 10],
            ['id' => 69 , 'title' => '酒店','unique_code' => 'jiudian1' , 'parent_id' => 11],
            ['id' => 70 , 'title' => '积分打电话','unique_code' => 'jifendadianhua1' , 'parent_id' => 12],
            ['id' => 71 , 'title' => '淘宝','unique_code' => 'taobao' , 'parent_id' => 13],
            ['id' => 72 , 'title' => '京东','unique_code' => 'jingdong' , 'parent_id' => 13],
            ['id' => 73 , 'title' => '唯品会','unique_code' => 'weipinhui' , 'parent_id' => 13],
            ['id' => 74 , 'title' => '拼多多','unique_code' => 'pinduoduo' , 'parent_id' => 13],
            ['id' => 75 , 'title' => '共享充电宝','unique_code' => 'gongxiangchongdianbao' , 'parent_id' => 14],
            ['id' => 76 , 'title' => '康养','unique_code' => 'kangyang' , 'parent_id' => 14],
            ['id' => 77 , 'title' => '售货机','unique_code' => 'shouhuoji' , 'parent_id' => 14],
            ['id' => 78 , 'title' => '肯德基','unique_code' => 'kendeji' , 'parent_id' => 15],
            ['id' => 79 , 'title' => '饿了么','unique_code' => 'eleme' , 'parent_id' => 15],
            ['id' => 80 , 'title' => '美团外卖','unique_code' => 'meituanwaimai' , 'parent_id' => 15],
            ['id' => 81 , 'title' => '美团团购','unique_code' => 'meituantuangou' , 'parent_id' => 15],
            ['id' => 82 , 'title' => '大众点评','unique_code' => 'dazhongdianping' , 'parent_id' => 15],
            ['id' => 83 , 'title' => '电影票','unique_code' => 'dianyingpiao' , 'parent_id' => 15],
            ['id' => 84 , 'title' => '周边生活','unique_code' => 'zhoubianshenghuo' , 'parent_id' => 15],
            ['id' => 85 , 'title' => '星巴克','unique_code' => 'xingbake' , 'parent_id' => 15],
            ['id' => 86 , 'title' => '麦当劳','unique_code' => 'maidanglao' , 'parent_id' => 15],
        ];

        if (self::BUSINESS_LEVEL == 0) {
            $data = array_filter($data,function ($item){
                return $item['parent_id'] == 0;
            });
        }

       \Example\Models\Business::query()->create($data);
    }
}
